<template>
  <div class="dashboard-container">
        当前绑定的app:
      <el-select v-model="currentApp"  @change="changeApp" placeholder="请选择一级菜单">
    <el-option
      v-for="item in apps"
      :key="item.value"
      :label="item.label"
      :value="item.value">
    </el-option>
  </el-select>
  </el-form-item >
    </div>
  </div>
</template>

<script>
import { mapGetters } from "vuex";
import request from "@/utils/request";

export default {
  name: "",
  computed: {
    ...mapGetters(["name"])
  },
  data() {
    return {
      apps:[],
      currentApp:""
    }
  },
  created() {
    this.loadData();
     if(sessionStorage.getItem("currentApp")){
      this.currentApp = sessionStorage.getItem("currentApp")
    }
  },
  methods: {
    loadData() {
      request({
        url: "admin/list/appid",
        method: "get",
        params: {}
      }).then(res => {
        this.apps=res.data;
        // sessionStorage.setItem("name", res.message);
      });
    },
    changeApp(){
       sessionStorage.setItem("currentApp",  this.currentApp);
    }
  }
}
</script>

<style lang="scss" scoped>
.dashboard {
  &-container {
    margin: 30px;
  }
  &-text {
    font-size: 30px;
    line-height: 46px;
  }
}
</style>
